<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <input type="text" v-model="checkedfood">
        <button @click="hander">添加</button>
        <div>
            <p>正在进行中</p>
            <div v-for="(item,index) in list">
                <input :key="item.id" type="checkbox" @change="_checkbox(item,index)">
                {{item.txt}}
                <button @click="del(index)">删除</button>
            </div>

        </div>
        <div>
            <p>已完成</p>
            <div  v-for="(item,index) in newlist">
                
                {{item.txt}}
            </div>

        </div>

    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        let vm = new Vue({
            el: "#app",
            data: {
                checkedfood: "",
                list: [],
                newlist: [],
                check: false
            },
            methods: {
                hander() {

                    this.list.push({txt:this.checkedfood,id:Date.now()})
                    // console.log(this.list);
                },
                del(index) {
                    this.list.splice(index, 1)
                },
                _checkbox(val,index) {
                    this.list.splice(index, 1)
                    this.newlist.push(val)
                    // console.log(index);

                }
            }
        })
    </script>
</body>

</html>